home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / GRAPHICS / RAYTRACING / POVRAY3 / POV301 / povray3 / pov3demo / showoff / pov / blobloop next >
Text File  |  1995-11-08  |  4KB  |  134 lines

  1. // Persistence Of Vision raytracer version 3.0 sample file.
  2. // File: BlobLoop.POV
  3. // Vers: 3
  4. // Desc: Shows off the while loop for creating complex blob objects.
  5. // Date: 10/1/95
  6. // Auth: Eduard Schwan
  7.  
  8. #version 3.0
  9. global_settings { assumed_gamma 1.0 }
  10.  
  11. // ------------------------------------------------------------------
  12. // Look down at an angle at our creation
  13. camera
  14.   location  <0, 10, -8>
  15.   direction 1*z
  16.   look_at   <0, 0, 0>
  17.  
  18.  
  19. // ------------------------------------------------------------------
  20. // Light source # 1
  21. light_source { <30, 20, -30> color rgb 1 }
  22.  
  23. // Light source # 2
  24. light_source { <-10, 30, -30> color rgb 0.5 }
  25.  
  26.  
  27. // ------------------------------------------------------------------
  28. // Simple dark background for a simple scene
  29. background { color rgb <0.0, 0.1, 0.2> }
  30.  
  31.  
  32. // ------------------------------------------------------------------
  33. // A white marble floor
  34. plane
  35. {
  36.   y, -0.1
  37.   texture
  38.   {
  39.     pigment
  40.     {
  41.       marble
  42.       turbulence 0.5 omega 0.7 rotate -40*y scale 6
  43.       color_map
  44.       {
  45.         [0.50 color rgb 1.0]
  46.         [0.57 color rgb 0.8]
  47.         [0.60 color rgb <0.9,0.8,0.7>]
  48.         [0.63 color rgb 1.0]
  49.       }
  50.     }
  51.     finish {ambient 0.2 reflection 0.3}
  52.   }
  53. }
  54.  
  55.  
  56. // ------------------------------------------------------------------
  57. // Set up the loop variables:
  58. // the Counter variable will go from 0.0 to 1.0 in NumIterations loops.
  59. #declare NumIterations = 60     // You can change this, try 20, 40, 60 too
  60.  
  61. // leave these next calculations alone
  62. #declare Increment     = 1.0/NumIterations
  63. #declare NumTwists     = 360*2  // # of full twists
  64. #declare Height        = 5      // total height of object
  65.  
  66.  
  67. // ------------------------------------------------------------------
  68. // Here is the large loop-generated blob
  69. blob
  70. {
  71.   threshold 0.1
  72.  
  73.   // create a series of components, using a while-loop
  74.   #declare Counter = 0.001
  75.   #while (Counter<=1.0)
  76. // #debug concat("Cnt=",str(Counter,2,4)," Inc=",str(Increment,5,8),"\n")
  77.  
  78.     // put a rod across axis
  79.     cylinder
  80.     {
  81.       <-5*(1-Counter), Counter*Height, 0>,  // <xyz> of one end
  82.       < 5*(1-Counter), Counter*Height, 0>,  // <xyz> of other end
  83.       Increment*20,                         // radius
  84.       2                                     // blob component strength
  85.       // put down the texture AFTER the component is in place
  86.       // so it lines up across them
  87.       texture
  88.       {
  89.         // make the color change as we wind our way up the shape
  90.         pigment { color rgb Counter/2 }
  91.         finish { ambient 0.2 specular 0.6 reflection 0.3 roughness 0.01 }
  92.       }
  93.       rotate Counter*NumTwists*y
  94.     }
  95.  
  96.     // now add a ball on each end of the rod
  97.     sphere
  98.     {
  99.       <-5*(1-Counter), Counter*Height, 0>, Increment*30, 2
  100.       rotate Counter*NumTwists*y
  101.       // put down the texture AFTER the component is in place
  102.       // so it lines up across them
  103.       texture
  104.       {
  105.         // make the color change as we wind our way up the shape
  106.         pigment { color rgb <Counter, 0, 1> }
  107.         finish { ambient 0.2 specular 0.6 reflection 0.3 roughness 0.01 }
  108.       }
  109.     }
  110.  
  111.     sphere
  112.     {
  113.       < 5*(1-Counter), Counter*Height, 0>, Increment*30, 2
  114.       rotate Counter*NumTwists*y
  115.       // put down the texture AFTER the component is in place
  116.       // so it lines up across them
  117.       texture
  118.       {
  119.         // make the color change as we wind our way up the shape
  120.         pigment { color rgb <1, 0, Counter> }
  121.         finish { ambient 0.2 specular 0.6 reflection 0.3 roughness 0.01 }
  122.       }
  123.     }
  124.     // manually increment our counter inside the loop
  125.     #declare Counter=Counter+Increment
  126.   #end
  127.  
  128.   rotate -30*y // view from a better angle
  129. }
  130.  
  131.  
  132.